﻿@{
    Layout = null;
}

<!DOCTYPE html>
@model ElingOA6_Admin_DSJCJ.Model.Task
<html>
<head>
    <title></title>
        @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageCommon.js", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(
        new StyleSheet { ExtensionType = ExtensionType.ListBox }
    )
    @Html.DevExpress().GetScripts(
         new Script { ExtensionType = ExtensionType.ListBox }
    )
        @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme },
        new StyleSheet { ExtensionType = ExtensionType.GridView, Theme = DevExpressHelper.Theme }
)


<script>

    $(document).ready(function () {
        var hdjsAlert = $("#hdjsAlert").val();
        $("#toolMenu").smartFloat();
        if (hdjsAlert == "OK") {
            alert("操作成功");
            window.location.href = rootPath + "/Admin/Taskregister";
        }
        else if (hdjsAlert == "error") {
            alert("操作失败");
        }
        else if (hdjsAlert == "qx") {
            alert("无登记权限！");
            window.location.href = rootPath + "/Admin/Taskregister";
        }
        else if (hdjsAlert == "sj") {
            alert("要求完成时间不可大于登记时间！");
        }
    });

    function OK() {
        var FContenttxt = FContent.GetText();
        if (FContenttxt == "") {
            alert("详细内容不可为空");
            return;
        }

        var FScorettxt = FScore.GetText();
        if (FScorettxt == "") {
            alert("分值不可为空");
            return;
        }

        form1.submit();
    }

    function valuecheck(s, e) {
        var clientFDocClsCdObj = ASPxClientTextBox.Cast("FScore");
        clientFDocClsCdObj.Validate();
        if (!clientFDocClsCdObj.GetIsValid()) {
            isCtlAllValid = false;
            return;

        }
    }

    function MenuTop_emClick(source, e) {
        switch (e.item.name) {
            case "btnSave":
                {
                    //保存
                    OK();
                    break;
                }
            case "btnCancel":
                {
                    //密码重置
                    window.location.href = rootPath + "/Admin/Taskregister/Index";
                }
        }
    }

    function ValueChanged() {
        var id = FTaskClassCd.GetValue();
        $.ajax({
            type: 'POST',
            url: rootPath + '/Admin/Taskregister/GetFScore',
            data: { id: id },
            success: function (result) {
                if (result != "") {

                    FScore.SetText(result);
                } 
            }
        });
    }

</script>
</head>
<body>
    @using (Html.BeginForm("Save", "Taskregister", FormMethod.Post, new { id = "form1", @class = "tableFrom" }))
    {
        <div class="floatToolMenu" id="toolMenu">
        @Html.DevExpress().Menu(settings =>
   {
       settings.Name = "toolBarMenu";
       settings.ItemAutoWidth = false;
       settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
       settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
       settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);
       settings.Items.Add(item =>
       {
           item.Name = "btnSave";
           item.Text = "保存";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

       });
       settings.Items.Add(item =>
       {
           item.Name = "btnCancel";
           item.Text = "取消";
           item.ClientEnabled = true;
           item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

       });
       settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
       settings.ItemLinkMode = ItemLinkMode.ContentBounds;
   }).GetHtml()
   </div>
    <table class="tableForm">
             <tr>
                <th style=" width:20%">责任科室 :</th>
                <td style=" width:80%" class="tdClass">
   @Html.DevExpress().ComboBox(
            settings =>
            {
                settings.Name = "FDeptNo";
                settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                settings.Properties.TextField = "FDeptName";
                settings.Properties.ValueField = "FDeptNo";
                settings.SelectedIndex = 0;
                settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                //settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s,e){alert(s.GetValue());}";
            }).BindList(ViewData["DeptList"]).Bind(Model.FDeptNo).GetHtml()
                </td>
            </tr>

            <tr>
                <th>类别:</th>
                <td class="tdClass">
          @Html.DevExpress().RadioButtonList(settings =>
     {
         settings.Name = "FTaskClassCd";
         settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
         settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;

         settings.Properties.ClientSideEvents.ValueChanged = "ValueChanged";
         settings.Properties.RepeatColumns = 6;
         settings.Properties.ValueField = "FTaskClassCd";
         settings.Properties.TextField = "FTaskClassName";
         settings.SelectedIndex = 0;
         settings.Width = System.Web.UI.WebControls.Unit.Pixel(400);
     }).BindList(ViewData["CdTaskClassList"]).Bind(Model.FTaskClassCd).GetHtml()
                </td>
            </tr>
            <tr>
                <th>
                    登记时间:</th>
                <td class="tdClass">
             @Html.DevExpress().DateEdit(settings =>
        {
            settings.Name = "FBeginDate";
            settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
            settings.Date = Model.FInsDate == null ? DateTime.Now : DateTime.Parse(Model.FInsDate.ToString());
            settings.ReadOnly = true;
        }).GetHtml()
                </td>
            </tr>
            <tr>
                <th>
                    要求完成时间:</th> 
                <td class="tdClass">
                         @Html.DevExpress().DateEdit(settings =>
                    {
                        settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
                        settings.Name = "FEndDate";
                        settings.Date = Model.FBeginDate == null ? DateTime.Now : DateTime.Parse(Model.FInsDate.ToString()); ;
                    }).GetHtml()
                    </td>

</tr>
            <tr>
            <th>分值:</th>
                <td  class="tdClass">
 @Html.DevExpress().TextBox(settings =>
{
    settings.Name = "FScore";
    settings.Properties.ClientSideEvents.Validation = "function(s,e){notEmptyAndNumericValidation(s,e,'分值')}";
    settings.Properties.ClientSideEvents.ValueChanged = "function(s, e) { valuecheck(s,e) }";
    settings.Width = System.Web.UI.WebControls.Unit.Pixel(150);
    settings.Text = Model.FScore == null ? "" : Model.FScore.ToString();
}).GetHtml()
                               </td>
            </tr>
            <tr>
                <th>详细内容:
                    </th>
                <td class="tdClass">
     @Html.DevExpress().Memo(settings =>
{
    settings.Name = "FContent";
    settings.Text = Model.FContent;
    settings.Width = System.Web.UI.WebControls.Unit.Pixel(400);
    settings.Height = System.Web.UI.WebControls.Unit.Pixel(60);
}).GetHtml()
                </td>
              </tr>
            
    </table>
        
        @Html.Hidden("hdMethod", ViewData["hdMethod"]);
        @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]));                                             
    }

</body>
</html>
